/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.

package cn.firstsoft.firstframe.util;

import java.io.*;

// Referenced classes of package cn.firstsoft.firstframe.util:
//            FirstUtil

public class Builder {

	public Builder() {
	}

	public static void main(String args[]) throws FileNotFoundException,
			IOException {
		System.out.println("请输入(y/n):");
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new BufferedInputStream(System.in)));
		try {
			String common = in.readLine();
			if (!common.toLowerCase().equals("y")
					&& !common.toLowerCase().equals("yes"))
				return;
		} catch (IOException e) {
			return;
		}
		String content = "";
		String src = "";
		String des = "";
		String desPath = "";
		
		//java层模块
		desPath = (new StringBuilder(String.valueOf(BASE_DIR)))
				.append(CLASS_DIR).append("/").append(MODULE).toString();
		if (!FirstUtil.exists(desPath))
			FirstUtil.mkdir(desPath);
		//jsp层模块
		desPath = (new StringBuilder(String.valueOf(BASE_DIR))).append(JSP_DIR)
				.append("/").append(MODULE).toString();
		if (!FirstUtil.exists(desPath))
			FirstUtil.mkdir(desPath);
		
		
		
		if (dao) {
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/Dao.java").toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/dao/").append(OBJECT).append("Dao.java")
					.toString();
			desPath = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/dao").toString();
			if (!FirstUtil.exists(desPath))
				FirstUtil.mkdir(desPath);
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
		}
		
		if (domain) {
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/Domain.java").toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/domain/").append(OBJECT).append(".java")
					.toString();
			desPath = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/domain").toString();
			if (!FirstUtil.exists(desPath))
				FirstUtil.mkdir(desPath);
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
		}
		if (manager) {
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/Manager.java").toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/service/logic/").append(OBJECT)
					.append("Manager.java").toString();
			desPath = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/service").toString();
			if (!FirstUtil.exists(desPath)) {
				FirstUtil.mkdir(desPath);
				System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
						.append(desPath).toString());
			}
			desPath = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/service/logic").toString();
			if (!FirstUtil.exists(desPath)) {
				FirstUtil.mkdir(desPath);
				System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
						.append(desPath).toString());
			}
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
		}
		if (controller) {
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/ManagerController.java")
					.toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/web/").append(OBJECT)
					.append("ManagerController.java").toString();
			desPath = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(CLASS_DIR).append("/").append(MODULE)
					.append("/web").toString();
			if (!FirstUtil.exists(desPath))
				FirstUtil.mkdir(desPath);
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
		}
		if (jsp) {
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/_list.jsp").toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR))).append(JSP_DIR)
					.append("/").append(MODULE).append("/").append(VARIABLE)
					.append("_list.jsp").toString();
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/_show.jsp").toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR))).append(JSP_DIR)
					.append("/").append(MODULE).append("/").append(VARIABLE)
					.append("_show.jsp").toString();
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
			src = (new StringBuilder(String.valueOf(BASE_DIR)))
					.append(TEMPLATE_DIR).append("/_edit.jsp").toString();
			des = (new StringBuilder(String.valueOf(BASE_DIR))).append(JSP_DIR)
					.append("/").append(MODULE).append("/").append(VARIABLE)
					.append("_edit.jsp").toString();
			content = FirstUtil.readFile(src, "UTF-8");
			content = content.replaceAll("MODULE", MODULE);
			content = content.replaceAll("OBJECT", OBJECT);
			content = content.replaceAll("VARIABLE", VARIABLE);
			content = content.replaceAll("CHINESENAME", CHINESENAME);
			FirstUtil.writeFile(content, des, "UTF-8");
			System.out.println((new StringBuilder("\u521B\u5EFA\uFF1A"))
					.append(des).toString());
		}
	}

	public static String BASE_DIR = "D:/myeclipsework/Kingdeeoa";
	public static String TEMPLATE_DIR = "/misc/builder";
	//public static String CLASS_DIR = "/src/cn/firstsoft/modules";
	//二次开发与正式产品隔离  com\goldhat\modules 以金冠为例  com.公司缩写.modules
	public static String CLASS_DIR = "/src/com/goldhat/modules";
	public static String JSP_DIR = "/webapp/modules";
	
	/* 标准产品
	public static String MODULE = "adress";
	public static String OBJECT = "AdressFavourites";
	public static String VARIABLE = "adressFavour";
	public static String CHINESENAME = "\u6536\u85CF\u901A\u8BAF\u5F55";
	*/
	//======native2ascii -reverse allMessages_zh_CN.properties allMessages_zh_CN.txt
	
	//模块变量定义
	public static String MODULE = "workflow";//文件夹
	public static String OBJECT = "WorkflowFileChange";//大写类名，文件名称
	public static String VARIABLE = "workflowFileChange";//变量定义，jsp页面名称
	public static String CHINESENAME = "\u53d8\u66f4\u5ba1\u6838";//中文信息
	
	//是否生成相关页面
	public static boolean dao = true;
	public static boolean domain=true;
	public static boolean manager = true;
	public static boolean controller = true;
	public static boolean jsp = true;

}


/*
	DECOMPILATION REPORT

	Decompiled from: D:\myeclipsework\Kingdeeoa\webapp\WEB-INF\lib\firstframe_6.2.jar
	Total time: 94 ms
	Jad reported messages/errors:
	Exit status: 0
	Caught exceptions:
*/